<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>全局组件的概念</title>
</head>
<body>
<div id="app1">
    <my-component></my-component>
</div>

<div id="app2">
    <my-component></my-component>
</div>

<script type="module">
    import {createApp, defineComponent} from "../../../../js/vue.esm-browser.js";

    // 定义组件
    let component = defineComponent(
        {
            template:
                "<h1>Hello, World!</h1><h1>世界，你好！</h1>"
        }
    )


    let app1 = createApp({
        setup() {
            return {}
        }

    })

    // 注册组件
    app1.component("my-component", component)
    app1.mount("#app1")

    let app2 = createApp({
        setup() {
            return {}
        }

    })

    // 注册组件
    app2.component("my-component", component)
    app2.mount("#app2")
</script>
</body>
</html>